export default class Cloud{
    constructor(viewer,maskImage){
        if (!viewer) throw new Error("请初始化viewer");
        this.viewer=viewer
        if (!maskImage) throw new Error("请填写图片路径");
        this.maskImage=maskImage
        this.maskLayer=undefined
    }
    init(){
        this.maskLayer = new Cesium.ImageryLayer(
          new Cesium.SingleTileImageryProvider({
            url: this.maskImage,
            rectangle: Cesium.Rectangle.fromDegrees(-180, -90, 180, 90), // 图片覆盖整个地球
          }),
          {
            alpha: 0.5, // 设置透明度，范围从0到1之间，0表示完全透明，1表示完全不透明
          }
        );
        this.viewer.imageryLayers.add(this.maskLayer);

    }
    destroy(){
        this.viewer.imageryLayers.remove(this.maskLayer);
    }
}